const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

let app_env = process.argv.find(function (item) {
    return 0 == item.indexOf('--env=')
})


if(app_env){
    app_env = app_env.substring(6)
    require(`${__dirname}/webpack.mix.${app_env}.js`);
    return;
}
mix.webpackConfig({
    devServer: {
        disableHostCheck: true,
        port: 8800
    }

})

mix.js('resources/js/app.js', 'public/_static/app/js')
    .extract()
    .sass('resources/sass/app.scss', 'public/_static/app/css');
